package cn.ycc1.boot3mvc.user.service.impl;

import cn.ycc1.boot3mvc.user.vo.UserExportVo;
import cn.ycc1.boot3mvc.user.vo.UserQueryVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.ycc1.boot3mvc.user.domain.User;
import cn.ycc1.boot3mvc.user.service.UserService;
import cn.ycc1.boot3mvc.user.mapper.UserMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.List;

/**
* @author mi
* @description 针对表【user(用户表)】的数据库操作Service实现
* @createDate 2023-11-18 20:04:49
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService{
    @Autowired
    UserMapper userMapper;
    @Override
    public IPage<User> getPage(UserQueryVo queryVo) {
        IPage page = new Page(queryVo.getPageNum(), queryVo.getPageSize());
        return userMapper.getPage(page, queryVo);
    }

    @Override
    public User getDetail(Long id) {
        Assert.notNull(id, "id不能为空");
        return userMapper.selectById(id);
    }

    @Override
    public List<UserExportVo> getList() {
        return userMapper.getList();
    }
}




